using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;

public class TargetArrow : MonoBehaviour
{
    public Transform Target { get; set; }

    [SerializeField]
    private TextMeshPro _distText;


    // Update is called once per frame
    void Update()
    {
        Vector3 current = transform.up;
        Vector3 direction = Target.position - transform.position;
        Vector3 to = direction.normalized;
        transform.up = Vector3.RotateTowards(
            current, to, 3f * Time.deltaTime, 500f);

        _distText.text = $"{(Mathf.RoundToInt(direction.magnitude)).ToString()}m";
    }
}
